package com.example.cloudcustomer.controller;

import com.example.cloudcustomer.client.CustomerClient;
import com.example.cloudcustomer.service.CustomerService;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
import com.netflix.discovery.shared.Application;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Project: spring-cloud
 * @Package: com.example.cloudcustomer.controller
 * @Author: 壹陸捌
 * @Time: 2025 - 08 - 04 18 : 00
 * @Description: 服务消费方
 */
@RestController
public class CustomerController {

//    private static final Logger log = LoggerFactory.getLogger(CustomerController.class);

//    @Autowired
//    private CustomerClient customerClient;

    @Autowired
    private CustomerService customerService;

    @RequestMapping("/selectCustomer/{mark}")
    public String selectCustomer(@PathVariable("mark") String mark) throws InterruptedException {
        System.out.println("开始发起远程调用");
        String result = customerService.selectProvide(mark);
//        String result = "远程调用未成功";
//        for (int i = 0; i < 6; i++) {
//            result = customerService.selectProvide(mark);
//        }
        System.out.println("远程调用成功");
        return result;
    }


}
